#include "../h/Event.h"
#include "Poco/DateTime.h"
#include "Poco/DateTimeParser.h"
#include <string>
#include <iostream.h>
using namespace std;
using namespace Poco;


Event::Event()
{
	date = DateTime ();
	user = "";
	energyType = "";
	amount = 0;
	price = 0;
	empty = true;
}

Event::Event(Event* e)
{
	this-> date = e->date;
	this-> user = e ->user;
	this->energyType = e->energyType;
	this->amount = e->amount;
	this->price = e->price;
	this->type = e->type;
	this ->empty = e -> empty;
}

Event::Event(DateTime date_, string user_, string energyType_,string type_, int amount_)
{
	date = date_;
	user = user_;
	energyType = energyType_;
	amount = amount_;
	price = 0;
	type=type_;
	empty = false;

}

Event::Event(DateTime date_,string user_,string energyType_,string type_,int amount_, double price_)
{
	date = date_;
	user = user_;
	energyType = energyType_;
	amount = amount_;
	price = price_;
	type=type_;
	empty = false;
}

void Event::UpdateEvent(int newAmount)
{
	amount=newAmount;
}
DateTime Event::getDate()
{
	return date;
}

string Event::getUser()
{
	return user;
}

string Event::getEnergyType()
{
	return energyType;
}

int Event::getAmount()
{
	return amount;
}

double Event::getPrice()
{
	return price;
}

Event& Event::operator=(const Event &e)
{
	if (this == &e)
		return *this;
	this-> date = e.date;
	this-> user = e.user;
	this->energyType = e.energyType;
	this->amount = e.amount;
	this->price = e.price;
	this->type = e.type;
	this ->empty = e.empty;
	return *this;
}

//User& User:: operator=(const User& other)
//{
//	if (this == &other)
//			return *this;
//	this->clear();
//	this->copy(other);
//	return *this;
//}

string Event::getType()
{
	return type;
}

bool Event::isEmpty()
{
	return(empty);
}

void Event::print()
{
	cout<<"the date is "<<date.day()<<", " << date.month()<< ", " << date.year() <<endl;
	cout<<"the type is "<<type<<endl;
	cout<<"the user is "<<user<<endl;
	cout<<"the energy is "<<energyType<<endl;
	cout<<"the amount is "<<amount<<endl;
	cout<<"the price is "<<price<<endl;
	cout<<"----------------------------------------\n";

}
